/****** Object: View [dbo].[vw_Signer]   Script Date: 2014-01-19 21:49:38 ******/
USE [SHMIS];
GO
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_Signer]'))
BEGIN
DROP VIEW [dbo].[vw_Signer];
END
GO

SET ANSI_NULLS ON;
GO
SET QUOTED_IDENTIFIER ON;
GO
CREATE VIEW [dbo].[vw_Signer]
AS
select contract_num, version,
(select top 1 sign_unit from BI_Signer order by Version desc) as Sign_unit,
(select top 1 Property from BI_Signer order by Version desc) as Property,
(select top 1 legal_person from BI_Signer order by Version desc) as legal_person,
(select top 1 passport_type from BI_Signer order by Version desc) as passport_type,
(select top 1 passport_unit from BI_Signer order by Version desc) as passport_unit,
(select top 1 passport_date from BI_Signer order by Version desc) as passport_date,
(select top 1 passport_end_date from BI_Signer order by Version desc) as passport_end_date,
(select top 1 register_money from BI_Signer order by Version desc) as register_money,
(select top 1 register_address from BI_Signer order by Version desc) as register_address,
(select top 1 operation_content from BI_Signer order by Version desc) as operation_content,
(select top 1 contact_person from BI_Signer order by Version desc) as contract_person,
(select top 1 contact_address from BI_Signer order by Version desc) as contact_address,
(select top 1 zip_code from BI_Signer order by Version desc) as zip_code,
(select top 1 phone from BI_Signer order by Version desc) as phone,
update_date,cre_user,cre_date,chg_user,chg_date,verified,verify_user,deleted
from BI_Signer
GO

